In [29]:
from __future__ import division, print_function, unicode_literals
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
The city of Chicago Disaster Recovery Plan was made largely in response to severe floods in April of 2013. The city also did most of its analysis by zip code, and while Austin generally had the most calls per event, interestingly for this specific event which prompted the funding request, it had fewer 311 calls than Chatham, but still the second highest out of the other top 6 community areas for flooding.
In [14]:
comm_df = pd.read_csv('311_data/flood_calls_311_comm.csv')
# Taking top 6 community areas for flooding
comm_df = comm_df[['Created Date','AUSTIN','ROSELAND','CHICAGO LAWN','AUBURN GRESHAM','WASHINGTON HEIGHTS','CHATHAM']].copy()
comm_df['Created Date'] = pd.to_datetime(comm_df['Created Date'])
comm_df = comm_df.set_index(pd.DatetimeIndex(comm_df['Created Date']))
# Just get calls since the beginning of 2010
comm_df = comm_df['2010-01-01':]
comm_df.head()
Out[14]:
In [15]:
comm_month_grp = comm_df.groupby([comm_df.index.year,comm_df.index.month]).sum()
comm_month_grp.head()
Out[15]:
In [25]:
comm_month_grp.sum().plot(title='Top 6 Community Areas by Flooding 311 Calls - 2010-Present', kind='bar')
Out[25]:
In [24]:
plt.rcParams["figure.figsize"] = [15, 5]
comm_month_grp.plot(title='Flooding 311 Calls by Top 6 Community Areas - 2010-Present')
Out[24]:
In [23]:
april_df = comm_df['2013-04-01':'2013-05-01']
april_df.plot(title='Flooding 311 Calls by Top 6 Community Areas - April 2013')
Out[23]:
In [22]:
april_df.sum().plot(title='Flooding 311 Calls - April 2013', kind='bar')
Out[22]:
In [28]:
mid_april_df = comm_df['2013-04-15':'2013-04-25']
mid_april_df.plot(title='Flooding 311 Calls by Top 6 Community Areas - Mid-April 2013')
Out[28]:
In [ ]: